package com.seckill.service;

import com.seckill.config.RabbitMQDirectConfig;
import com.seckill.pojo.UserDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 胡成
 * @Version: 0.0.1V
 * @Date: 2018/12/7
 * @Description: 类描述
 **/
@Slf4j
@Service
public class ReceiverDirectService {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void sendDirectQueue(){
        UserDTO userDTO = new UserDTO();
        userDTO.setUserId("10000");
        userDTO.setName("zhangsan");
        log.info("【sendDirectQueue已发送消息】");
        //第一个参数是指要发送到哪个队列里面，第二个参数是指要发送到内容
        amqpTemplate.convertAndSend(RabbitMQDirectConfig.QUEUE,userDTO);
    }
}
